<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="css/WdatePicker.css" rel="stylesheet" type="text/css" />
    <link href="css/select.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="js/select-ui.min.js"></script>

    <script type="text/javascript" src="js/WdatePicker.js"></script>

    <script language="javascript" src="./Lodop/LodopFuncs.js"></script>
    <object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
        <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="./Lodop/install_lodop.exe"></embed>
    </object>
    <script type="text/javascript">
        $(document).ready(function(e) {
            $(".select1").uedSelect({
                width : 345
            });
            $(".select2").uedSelect({
                width : 167
            });
            $(".select3").uedSelect({
                width : 100
            });
        });
    </script>

</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">表单</a></li>
    </ul>
</div>

<div class="formbody">

    <div class="formtitle"><span>客户信息</span></div>

    <ul class="forminfo">
        <li><label>客户名称<b>*</b></label><input name="cus_address" id="cus_name" type="text" class="dfinput" /></li>
        <li><label>柜台<b>*</b></label>
            <div class="vocation">
                <select class="select2" name='cus_level' id="cus_guitai">
                    <option value='精品柜'>精品柜</option>
                    <option>交互设计师</option>
                    <option>前端设计师</option>
                </select>
            </div>
        </li>
        <li><label>编号1<b>*</b></label><input name="cus_address" id="cus_number1" type="text" class="dfinput" /></li>
        <li><label>编号2<b>*</b></label><input name="cus_address" id="cus_number2" type="text" class="dfinput" /></li>
        <li><label>商品名称<b>*</b></label><input name="cus_address" id="cus_goods" type="text" class="dfinput" /></li>
        <li><label>条形码<b>*</b></label><input name="cus_address" id="cus_code" type="text" class="dfinput" /></li>
        <li><label>净重<b>*</b></label><input name="cus_phone" id="cus_jingzhong" type="text" class="dfinput" />
        <li><label>附加<b>*</b></label><input name="cus_address" id="cus_attach" type="text" class="dfinput" /></li>
        <li><label>基本<b>*</b></label><input name="cus_address" id="cus_base" type="text" class="dfinput" /></li>
        <li><label>毛重<b>*</b></label><input name="cus_address" id="cus_maozhong" type="text" class="dfinput" /></li>
        <li><label>&nbsp;</label><input name="" type="button" onclick="prn1_preview()" id='btn' class="btn" value="添加"/></li>
    </ul>
</div>



<p>1：若只打印《表单一》,看一下<a href="javascript:prn1_preview()">打印预览</a>,可<a href="javascript:prn1_print()">直接打印</a>也可
    <a href="javascript:prn1_printA()">选择打印机</a>打印。<br><br>
    2：若《表单一》和《表单二》一起并列输出,看一下<a href="javascript:prn_Design()">打印设计</a>,其布局风格可<a href="javascript:prn2_manage()">打印维护</a>调整。
<p>3：若打印整个页面,看看<a href="javascript:prn3_preview()">打印预览</a>。<br><br>
    本例要点是用Document的innerHTML方法把打印目标的超文本送给控件。
<p><a href="PrintSampIndex.html">&lt;&lt;回样例目录</a>
</p>

</body>
<script type="text/javascript" src="js/WdatePicker.js"></script>
</html>
<script language="javascript" type="text/javascript">
    var LODOP; //声明为全局变量
    function prn1_preview() {
        CreateOneFormPage();
        LODOP.PREVIEW();
    };
    function prn_Design() {
        CreateOneFormPage()
        LODOP.PRINT_DESIGN();
    };
    function prn1_print() {
        CreateOneFormPage();
        LODOP.PRINT();
    };
    function prn1_printA() {
        CreateOneFormPage();
        LODOP.PRINTA();
    };
    function prn2_manage() {
        CreateOneFormPage();
        LODOP.PRINT_SETUP();
    };
    function CreateOneFormPage(){
        LODOP=getLodop(document.getElementById('LODOP'),document.getElementById('LODOP_EM'));


        LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_空白练习");
        LODOP.ADD_PRINT_RECT(130,229,290,155,0,2);
        LODOP.ADD_PRINT_BARCODE(234,233,117,44,"EAN128A",$('#cus_code').val());
        LODOP.ADD_PRINT_TEXT(202,232,146,24,$('#cus_goods').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
        LODOP.ADD_PRINT_TEXT(196,389,62,20,"净重："+$('#cus_jingzhong').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.ADD_PRINT_TEXT(216,389,100,18,"基本："+$('#cus_base').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
        LODOP.ADD_PRINT_TEXT(234,389,100,18,"毛重："+$('#cus_maozhong').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.ADD_PRINT_TEXT(251,389,126,18,getNowFormatDate()+(new Date().getHours()>12?'下':'上'));
        LODOP.SET_PRINT_STYLEA(0,"FontName","@黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
        LODOP.SET_PRINT_STYLEA(0,"Bold",1);
        LODOP.ADD_PRINT_TEXT(265,389,100,18,$('#cus_guitai').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",8);
        LODOP.ADD_PRINT_TEXT(196,451,62,20,"附加："+$('#cus_attach').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.ADD_PRINT_LINE(196,231,194,514,0,2);
        LODOP.ADD_PRINT_TEXT(132,231,145,25,$('#cus_name').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
        LODOP.ADD_PRINT_TEXT(133,397,117,20,$('#cus_number1').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
        LODOP.ADD_PRINT_TEXT(151,397,115,20,$('#cus_guitai').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
        LODOP.ADD_PRINT_TEXT(171,398,115,20,$('#cus_number2').val());
        LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",11);


    }

</script>
<script>

    $(function(){
        $('#btn').bind('click',function(){

            $.ajax({
                type:"post",
                data:{cus_name:cus_name,
                    cus_linkman:cus_linkman,
                    cus_sex:cus_sex,
                    cus_level:cus_level
                },
                url:"#?action=add",
                success:function(result){
                    if(result){
                        window.location.href = "./cuslist.php";
                    }else{
                        alert('添加失败');
                    }
                },
                error:function(){
                    alert("提交错误");
                }
            });
        });

    })
</script>
<script>
function getNowFormatDate() {
var date = new Date();
var seperator1 = "/";
var seperator2 = ":";
var year = date.getFullYear();
var month = date.getMonth() + 1;
    var minute = date.getMinutes();
    var hours = date.getHours();
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
    if(minute<10){
        minute = '0'+minute;
    }
    if(hours<10){
        hours = '0' +hours;
    }
var currentdate = year + seperator1 + month + seperator1 + strDate
+ " " + hours +seperator2+ minute;

return currentdate;
}
</script>